/*************************************************************************
	> File Name: P7223.cpp
	> Author: yufangze
	> Mail: 2224590123@qq.com
	> Created Time: 2024-12-27 15:25:58
 ************************************************************************/

#include <iostream>
#include <set>
#include <map>
#include <vector>
#include <algorithm>
using namespace std;

#define mod 998244353

long long quick_pow(long long a, long long b) {
    long long res = 1;
    while (b) {
        if (b & 1) res = (res % mod * a) % mod;
        a = (a * a) % mod;
        b >>= 1;
    }
    return res;
}

int main() {
    long long n, p, ans = 1;
    cin >> n >> p;
    for (int i = 1, v; i <= n; i++) {
        cin >> v;
        ans *= (quick_pow(p, v) + 1);
        ans %= mod;
    }
    cout << ans << endl;
    return 0;
}
